package com.extension.company.view.my.localorder.localorderfragment;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.extension.company.admin.R;
import com.extension.company.model.entity.SameCityOrderAllBean;
import com.extension.company.common.mvc.BaseFragment;
import com.extension.company.common.utils.ToastUtil;
import com.extension.company.view.my.localorder.adapter.LocalCityOrderUnUseAdapter;
import com.extension.company.view.my.localorder.LocalCityOrderDetailActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;


/**
 * 同城订单 --- 待使用 fragment
 */
public class LocalCityOrderUnUseFragment extends BaseFragment {


	private Context context;

	@BindView(R.id.un_use_list)
	RecyclerView recyclerView;


	private List<SameCityOrderAllBean> list = new ArrayList<>();
	private LocalCityOrderUnUseAdapter adapter;

	@Override
	public void onAttach(Context context) {
		super.onAttach(context);
		this.context = context;
	}

	@Override
	public void onDetach() {
		super.onDetach();
	}

	public static LocalCityOrderUnUseFragment newInstance() {
		LocalCityOrderUnUseFragment fragment = new LocalCityOrderUnUseFragment();
		return fragment;
	}


	@Override
	public void init() {

		recyclerView.setLayoutManager(new GridLayoutManager(context, 1));

		adapter = new LocalCityOrderUnUseAdapter(list, context);
		recyclerView.setAdapter(adapter);

		adapter.setOnListListener(new LocalCityOrderUnUseAdapter.OnListFragmentInteractionListener() {
			@Override
			public void localStoreUse() {
				ToastUtil.showToast(context, "去店铺支付");
			}

			@Override
			public void itemListener() {
				Intent intent = new Intent(context, LocalCityOrderDetailActivity.class);
				startActivity(intent);
			}
		});


	}

	@Override
	public int getMainLayout() {
		return R.layout.fragment_fragmenrunuse_list;
	}


}
